//
//  UIViewController+LogVc.m
//  SFASalesReport
//
//  Created by Vergil on 2017/1/5.
//  Copyright © 2017年 Jonas. All rights reserved.
//

#import "UIViewController+LogVc.h"
#import <objc/runtime.h>

@implementation UIViewController (LogVc)

+ (void)load {
    
    SEL originalSel = @selector(viewWillAppear:);
    SEL nowSel = @selector(yxLogViewDidLoad);
    
    Method originalMethod = class_getInstanceMethod([self class], originalSel);
    Method nowMethod = class_getInstanceMethod([self class], nowSel);
    
    if (class_addMethod([self class], originalSel, method_getImplementation(nowMethod), method_getTypeEncoding(nowMethod))) {
        
        class_replaceMethod([self class], nowSel, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
        
    } else {
        
        method_exchangeImplementations(originalMethod, nowMethod);
        
    }
    
}

- (void)yxLogViewDidLoad {
    [self yxLogViewDidLoad];
    TBLog(@"%@",NSStringFromClass([self class]));
}

@end
